#include "el.h"
#include "example.h"

static void example_timer_handle(void *userdata);

struct el_timer example_timer = {
  .callback = example_timer_handle,
  .userdata = &example_timer,
  .handle = NULL,
  .seconds = 1,
};

static void example_timer_handle (void *userdata)
{
  el_timer_mark(&example_timer);
  printf ("expired\n");
}


BOLT(add_timer, "timer add")
{
  if (example_timer.handle == NULL) {
    int ret = el_add_timer(&example_timer);
    printf("add timer ret=%d\n", ret);
  }
}

BOLT(del_timer, "timer delete")
{
  if (example_timer.handle != NULL){
    int ret = el_del_timer(&example_timer);
    printf("del timer ret=%d\n", ret);
  }
}

BOLT(hello, "hello <someone>")
{
  const char *argz = pop_argz();
  printf("hello %s\n", argz);
}


